package com.security.door.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.security.door.core.base.BaseService;
import com.security.door.dao.mapper.baseMenuMapper;
import com.security.door.model.domain.baseMenu;
import com.security.door.model.dto.baseMenuDto;
import com.security.door.service.IbaseMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class baseMenuServiceImpl extends BaseService<baseMenu> implements IbaseMenuService {

    @Autowired
    baseMenuMapper ibaseMenuMapper;

    @Override
    public PageInfo<baseMenu> queryListWithPage(baseMenuDto entity) {
        PageHelper.startPage(entity.getPageIndex(), entity.getPageSize());
        var actionList = ibaseMenuMapper.queryListWithPage(entity);
        return new PageInfo<>(actionList);
    }

    @Override
    public List<baseMenu> selectParent() {
        List<baseMenu> list = ibaseMenuMapper.selectParent();
        return list;
    }

    public List<baseMenu> selectByRoleCode(Map map) {
        return ibaseMenuMapper.selectByRoleCode(map);
    }

    public Integer getMenuId(Integer pMenuId) {
        return ibaseMenuMapper.getMenuId(pMenuId);
    }

    public Integer updateState(String guid) {
        return ibaseMenuMapper.updateState(guid);
    }

    public List<baseMenu> selectByUserId(String userId){return  ibaseMenuMapper.selectByUserId(userId);}
}
